#pragma once

#include "imconfig.h"
#include "imgui.h"
#include "imgui_impl_dx11.h"
#include "imgui_impl_win32.h"
#include "imgui_internal.h"
#include "imstb_rectpack.h"
#include "imstb_textedit.h"
#include "imstb_truetype.h"
#include "Font.h"

//#include <time.h>
#include <string.h>
//#include <iostream>
#include <d3d11.h>
#pragma comment(lib,"d3d11.lib")

// 项目专用函数库
#include "GetSetSystemCommon.h"





void CMD_SetLongPath_ON_Success(float& ScalingRatio, bool& SetLongPath_ON_Success) {
    static bool SetLongPath_ON_WinPos2 = true;//用于初始化窗口位置
    int Screen_Width{ GetSystemMetrics(SM_CXSCREEN) };//获取显示器的宽
    int Screen_Heigth{ GetSystemMetrics(SM_CYSCREEN) };//获取显示器的高
    if (SetLongPath_ON_WinPos2)//初始化窗口
    {
        ImGui::SetNextWindowPos({ float(Screen_Width - 213 * ScalingRatio) / 2,float(Screen_Heigth - 86 * ScalingRatio) / 2 });
        SetLongPath_ON_WinPos2 = false;//初始化完毕
    }
    ImGui::Begin("开启长路径支持提示", &SetLongPath_ON_Success, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking);//开始绘制窗口
    ImGui::Text("长路径支持开启成功！");
    ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.117f, 0.655f, 0.137f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.117f, 0.555f, 0.137f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.117f, 0.455f, 0.137f, 1.0f));
    if (ImGui::Button("好的"))
        SetLongPath_ON_Success = false;
    ImGui::PopStyleColor(3);
    ImGui::End();
}


void CMD_SetLongPath_ON_Fail(float& ScalingRatio, bool& SetLongPath_ON_Fail) {
    static bool SetLongPath_ON_WinPos2 = true;//用于初始化窗口位置
    int Screen_Width{ GetSystemMetrics(SM_CXSCREEN) };//获取显示器的宽
    int Screen_Heigth{ GetSystemMetrics(SM_CYSCREEN) };//获取显示器的高
    if (SetLongPath_ON_WinPos2)//初始化窗口
    {
        ImGui::SetNextWindowPos({ float(Screen_Width - 213 * ScalingRatio) / 2,float(Screen_Heigth - 86 * ScalingRatio) / 2 });
        SetLongPath_ON_WinPos2 = false;//初始化完毕
    }
    ImGui::Begin("开启长路径支持提示", &SetLongPath_ON_Fail, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking);//开始绘制窗口
    ImGui::Text("长路径支持开启失败！");
    ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.75f, 0.1f, 0.1f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.75f, 0.25f, 0.25f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.75f, 0.4f, 0.4f, 1.0f));
    if (ImGui::Button("取消设置"))
        SetLongPath_ON_Fail = false;
    ImGui::PopStyleColor(3);
    ImGui::End();
}


void CMD_SetLongPath_OFF_Success(float& ScalingRatio, bool& SetLongPath_OFF_Success) {
    static bool SetLongPath_OFF_WinPos2 = true;//用于初始化窗口位置
    int Screen_Width{ GetSystemMetrics(SM_CXSCREEN) };//获取显示器的宽
    int Screen_Heigth{ GetSystemMetrics(SM_CYSCREEN) };//获取显示器的高
    if (SetLongPath_OFF_WinPos2)//初始化窗口
    {
        ImGui::SetNextWindowPos({ float(Screen_Width - 213 * ScalingRatio) / 2,float(Screen_Heigth - 86 * ScalingRatio) / 2 });
        SetLongPath_OFF_WinPos2 = false;//初始化完毕
    }
    ImGui::Begin("关闭长路径支持提示", &SetLongPath_OFF_Success, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking);//开始绘制窗口
    ImGui::Text("长路径支持关闭成功！");
    ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.117f, 0.655f, 0.137f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.117f, 0.555f, 0.137f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.117f, 0.455f, 0.137f, 1.0f));
    if (ImGui::Button("好的"))
        SetLongPath_OFF_Success = false;
    ImGui::PopStyleColor(3);
    ImGui::End();
}


void CMD_SetLongPath_OFF_Fail(float& ScalingRatio, bool& SetLongPath_OFF_Fail) {
    static bool SetLongPath_OFF_WinPos2 = true;//用于初始化窗口位置
    int Screen_Width{ GetSystemMetrics(SM_CXSCREEN) };//获取显示器的宽
    int Screen_Heigth{ GetSystemMetrics(SM_CYSCREEN) };//获取显示器的高
    if (SetLongPath_OFF_WinPos2)//初始化窗口
    {
        ImGui::SetNextWindowPos({ float(Screen_Width - 213 * ScalingRatio) / 2,float(Screen_Heigth - 86 * ScalingRatio) / 2 });
        SetLongPath_OFF_WinPos2 = false;//初始化完毕
    }
    ImGui::Begin("关闭长路径支持提示", &SetLongPath_OFF_Fail, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking);//开始绘制窗口
    ImGui::Text("长路径支持关闭失败！");
    ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.75f, 0.1f, 0.1f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.75f, 0.25f, 0.25f, 1.0f));
    ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.75f, 0.4f, 0.4f, 1.0f));
    if (ImGui::Button("取消设置"))
        SetLongPath_OFF_Fail = false;
    ImGui::PopStyleColor(3);
    ImGui::End();
}